package com.frinder.seata.order.service;

import com.frinder.seata.data.base.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * @ClassName CallAccountService
 * @Description 远程调用账户服务
 * @Author frinder
 * @Date 2020/8/18 16:00
 * @Verion 1.0
 */
@FeignClient(value = "account-server", fallbackFactory = CallAccountFallbackFactory.class)
public interface CallAccountService {

    /**
     * @param timeout 是否模拟超时
     * @param userId
     * @param money
     * @param orderId
     * @param circle  是否实现闭环
     * @return
     */
    @RequestMapping(value = "/biz/account/decrease", method = RequestMethod.POST)
    Result decrease(@RequestParam boolean timeout,
                    @RequestParam long userId,
                    @RequestParam BigDecimal money,
                    @RequestParam long orderId,
                    @RequestParam boolean circle
    );
}
